/**     
* @Title: TransactionConfig.java   
* @Package me.security.example.config   
* @Description: TODO   
* @author xaoyaoyao
* @date 2017年8月22日 下午9:38:42
*/
package me.security.example.config;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.TransactionManagementConfigurer;

/**
 * @ClassName: TransactionConfig
 * @Description: TODO
 * @author xaoyaoyao
 * @date 2017年8月22日 下午9:38:42
 * 
 */
@Configuration
@ComponentScan
public class TransactionConfig implements TransactionManagementConfigurer {
	
	@Autowired
	private DataSource dataSource;

	@Bean(name = "transactionManager")
	@Override
	public PlatformTransactionManager annotationDrivenTransactionManager() {
		return new DataSourceTransactionManager(dataSource);
	}
}
